export default {
	install(Vue){
		Vue.mixin({
			data(){
				return{
					userRules:{
						loginName:{
							rules:[
								{
									required: true,
									errorMessage: '账号不能为空！',
								},
								{
									minLength:6,
									errorMessage:"账号长度不能少于{minLength}位",
								}
							]
						},
						loginPwd:{
							rules:[
								{
									required: true,
									errorMessage: '密码不能为空！',
								},
								{
									minLength:5,
									errorMessage:"密码长度不能少于{minLength}位",
								}
							]
						},
						phone:{
							rules:[
								{
									required:true,
									errorMessage:"手机号不能为空!",
								},
								{
									pattern:'^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\\d{8}$',
									errorMessage:"请填写正确的手机号码"
								}
							]
						},
						vCode:{
							rules:[
								{
									required:true,
									errorMessage:'请填写验证码',
								},
								{
									vlidataFunction:this.vlidatamobileCode
								}
							]
						}
					}
				}
			},
			methods:{
				//验证码
				vlidatamobileCode(rle,val,data,callback){
					switch(true){
						case val !== this.returnCode:
						callback('请输入正确的验证码')
						break
						default:
						return true
					}
				}
			}
		})
	}
}